TEAMNAME=Jtacck
ZIPNAME=$(TEAMNAME)_PPE.zip
PDFLATEX=pdflatex

TEXS=reflection.tex evaluation.tex
OTHERFILES=

PDFS=$(TEXS:%.tex=%.pdf)
ZIPPDFS=$(PDFS:%=$(TEAMNAME)_%)
ZIPOTHERFILES=$(OTHERFILES:%=$(TEAMNAME)_%)

all: pdf zip

evaluation.tex: eval-prototype.tex eval-reqs.tex header.tex
	touch $@

reflection.tex: header.tex
	touch $@

pdf: $(PDFS)

zip: pdf
	echo $(ZIPOTHERFILES)
	ls $(PDFS) $(OTHERFILES) | xargs -I '{}' cp {} Jtacck_{}
	zip $(ZIPNAME) -m $(ZIPPDFS) $(ZIPOTHERFILES)

clean:
	rm -f *.aux *.log *~

cleanall: clean
	rm -f $(PDFS) $(ZIPNAME)

%.pdf: %.tex
	while (echo "R\n" | $(PDFLATEX) $^ ; \
	grep -q "Rerun to get cross" `basename $^ .tex`.log ) do true ; \
	done

.phony: pdf zip clean cleanall all